package com.acme.orders.model;

import java.io.Serializable;
import java.util.List;
 
public class Category implements Serializable {

	private static final long serialVersionUID = 6880697886937370976L;

	private String id, description;
	private List<Product> products;

	public String getId() {
		return id;
	}
	public String getDescription(){
		return description;
	}	
	public List<Product> getProducts() {
		return products;
	}

	public Category setId(String id) {
		this.id = id;
		return this;
	}
	public Category setDescription(String description){
		this.description = description;
		return this;		
	}
	public Category setProducts(List<Product> products) {
		this.products = products;
		return this;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Category other = (Category) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
	
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Category [");
		if (id != null)
			builder.append(id).append("| ");
		if (description != null)
			builder.append(description);
		builder.append("]");
		return builder.toString();
	}
	
	
}

